package com.ruoyi.park.mapper;

import com.ruoyi.park.domain.MaHouseMaterial;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 仓库物资Mapper接口
 *
 * @author cjie
 * @date 2021-09-16
 */
public interface MaHouseMaterialMapper {
    /**
     * 查询仓库物资
     *
     * @param id 仓库物资ID
     * @return 仓库物资
     */
     MaHouseMaterial selectMaHouseMaterialById(String id);

    /**
     * 查询仓库物资列表
     *
     * @param maHouseMaterial 仓库物资
     * @return 仓库物资集合
     */
     List<MaHouseMaterial> selectMaHouseMaterialList(MaHouseMaterial maHouseMaterial);

    /**
     * 新增仓库物资
     *
     * @param maHouseMaterial 仓库物资
     * @return 结果
     */
     int insertMaHouseMaterial(MaHouseMaterial maHouseMaterial);

    /**
     * 修改仓库物资
     *
     * @param maHouseMaterial 仓库物资
     * @return 结果
     */
     int updateMaHouseMaterial(MaHouseMaterial maHouseMaterial);

    /**
     * 删除仓库物资
     *
     * @param id 仓库物资ID
     * @return 结果
     */
     int deleteMaHouseMaterialById(String id);

    /**
     * 批量删除仓库物资
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
     int deleteMaHouseMaterialByIds(String[] ids);

    /**
     * 通过仓库id和物资id查询
     * @param houseId 仓库id
     * @param materialId 物资id
     * @return
     */
    MaHouseMaterial selectMaHouseMaterialByHouseIdAndMaterialId(@Param("houseId") String houseId,@Param("materialId") String materialId);

    /**
     * 通过物资id统计库存量
     * @param materialId 物资id
     * @return
     */
    Double selectSumQuantityByMaterialId(String materialId);

    /**
     * 通过物资id查询对应仓库的物资数量
     * @param materialId 物资id
     * @return
     */
    List<Map<String, Object>> selectHouseMaterialQuantityByMaterialId(String materialId);

    /**
     * 统计对应仓库是否存在物资
     * @param houseId 仓库id
     * @return
     */
    int countMaHouseMaterialByHouseId(String houseId);
}
